package day5;

import java.util.InputMismatchException;

/**
 * @author oldliu
 * @since 1.0
 */
public class CharTest {
    public static void main(String[] args) {
        String name="닍닎닏닐닑.zip";
        int i1 = name.indexOf(".");//“.”的位置
        if (i1==-1)throw new InputMismatchException("格式不对");
        String i = name.substring(0,i1);
        char[] cr = i.toCharArray();
        for(int k:cr){
            if(!(k>=0x4E00&&k<=0x9FCC)){
                throw new InputMismatchException("非汉字");
            }
        }
//        for (Byte b1:i.getBytes()){
//            if (b1>0)throw new InputMismatchException("作业名不是中文");
//        }
        String j = name.substring(i1);
        if (j.contentEquals(".zip")||j.contentEquals(".rar"))
            System.out.println("true");
        else throw new InputMismatchException("作业不是压缩格式");

//        String s1="dog";
//        String s2="dogThis is a good dog,This is a good dog,This is a good dog";
//        String[] split = s2.split(s1);
//        System.out.println(split.length-1);
//        for(int i=0;i<=65535;i++){
//            System.out.print((char)i);
//            if(i%50==0)
//                System.out.println();
//        }
    }
}
